{extend name="index/base" /}
{block name="content"}
<div>
    <form class="layui-form" action="">
        <div class="layui-form-item">
            <label class="layui-form-label">host</label>
            <div class="layui-input-block">
                <input type="text" name="host" required value="{$data['host']}" lay-verify="required" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">path</label>
            <div class="layui-input-block">
                <input type="text" name="path" required value="{$data['path']}" lay-verify="required" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">port</label>
            <div class="layui-input-block">
                <input type="text" name="port" required value="{$data['port']}" lay-verify="required" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">version</label>
            <div class="layui-input-block">
                <input type="text" name="version" required value="{$data['version']}" lay-verify="required" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">md5</label>
            <div class="layui-input-block">
                <input type="text" name="md5" required value="{$data['md5']}" lay-verify="required" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">key</label>
            <div class="layui-input-block">
                <input type="text" name="key" required value="{$data['key']}" lay-verify="required" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">是否启用</label>
            <div class="layui-input-block">
                <input type="radio" name="status" value="1" title="开启" {eq name="$data['status']" value="1"}checked{/eq}>
                <input type="radio" name="status" value="0" title="禁用" {eq name="$data['status']" value="0"}checked{/eq}>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <input type="hidden" name="id" value="{$data['id']}">
                <a class="layui-btn" lay-submit lay-filter="submit">提交</a>
            </div>
        </div>
    </form>
</div>
{/block}
{block name="js"}
<script type="text/javascript">
    layui.use(['table','jquery','form','upload'], function(){
        var table = layui.table; var form = layui.form;var upload = layui.upload;
        var $ = layui.$;
        form.on('submit(submit)', function(data){
            console.log(data.field);
            var loading = layer.load(1, {shade: [0.1, '#fff']});
            $.post("{:url('editFile')}", data.field, function (res) {
                layer.close(loading);
                if (res.code == 0) {
                    layer.msg(res.msg, {time: 1000, icon: 1}, function () {
                        window.parent.location.reload();
                        return false;
                    });
                } else {
                    layer.msg(res.msg, {time: 1000, icon: 2});
                }
            });
        });
    });
</script>
{/block}